package org.springblade.modules.admin.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.modules.admin.dto.NewWorkPlanCloseDTO;
import org.springblade.modules.admin.dto.NewWorkPlanSendDTO;
import org.springblade.modules.admin.dto.NewWorkPlanSetTimeDTO;
import org.springblade.modules.admin.service.IMaintainPlanContentService;
import org.springblade.modules.admin.service.IMaintainPlanContentUserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 新事务工单 Controller Sharry部分
 * @author Sharry
 * @since 2023-11-13
 */
@RestController
@RequestMapping("/newWorkPlan")
@AllArgsConstructor
@Api(tags = "新事务工单")
public class NewWorkPlanController {

	private final IMaintainPlanContentService maintainPlanContentService;

	private final IMaintainPlanContentUserService maintainPlanContentUserService;

	@PostMapping("/send")
	@ApiOperationSupport(order = 10)
	@ApiOperation(value = "事务工单指派/转派", notes = "传入工单id及用户id 集合")
	public R<Boolean> send(@RequestBody NewWorkPlanSendDTO newWorkPlanSendDTO) {
		return R.data(maintainPlanContentUserService.send(newWorkPlanSendDTO));
	}

	@PostMapping("/set")
	@ApiOperationSupport(order = 11)
	@ApiOperation(value = "事务工单批量设置时间", notes = "传入批量设置时间以及 用户id 集合")
	public R<Boolean> set(@RequestBody NewWorkPlanSetTimeDTO newWorkPlanSetTimeDTO) {
		return R.data(maintainPlanContentService.setWorkPlanTimes(newWorkPlanSetTimeDTO));
	}

	@PostMapping("/close")
	@ApiOperationSupport(order = 12)
	@ApiOperation(value = "事务工单批量关闭", notes = "传入工单 id 集合")
	public R<Boolean> close(@RequestBody NewWorkPlanCloseDTO newWorkPlanCloseDTO) {
		return R.data(maintainPlanContentService.closeBatch(newWorkPlanCloseDTO));
	}



}
